package com.cn.hangyun.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cn.hangyun.common.CustomerContextHolder;
import com.cn.hangyun.model.User;
import com.cn.hangyun.service.IUserService;


@Controller
@RequestMapping("/user")
public class UserController {

	private IUserService userService;

	@Autowired
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	@RequestMapping("/showUser")
	public String showUser(HttpServletRequest request) {
		//CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_MYSQL);
		User u = userService.getUserById("8");
		request.setAttribute("user", u);
		return "showUser";
	}
	
	@RequestMapping("/showFrame")
	@ResponseBody
	public String showFrame(String name,String password) {
		System.out.println(name);
		System.out.println(password);
		return "haha";
	}

}
